import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { cameraGroupVO, cameraGroupForm, cameraGroupQuery } from '@/api/security/camera/camera-group/types';

/**
 * 查询摄像头分组列表
 * @param query
 * @returns {*}
 */

export const listcameraGroup = (query?: cameraGroupQuery): AxiosPromise<cameraGroupVO[]> => {
  return request({
    url: '/camera/camera-group/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询摄像头分组详细
 * @param cameraGroupId
 */
export const getcameraGroup = (cameraGroupId: string | number): AxiosPromise<cameraGroupVO> => {
  return request({
    url: '/camera/camera-group/' + cameraGroupId,
    method: 'get'
  });
};

/**
 * 新增摄像头分组
 * @param data
 */
export const addcameraGroup = (data: cameraGroupForm) => {
  return request({
    url: '/camera/camera-group',
    method: 'post',
    data: data
  });
};

/**
 * 修改摄像头分组
 * @param data
 */
export const updatecameraGroup = (data: cameraGroupForm) => {
  return request({
    url: '/camera/camera-group',
    method: 'put',
    data: data
  });
};

/**
 * 删除摄像头分组
 * @param cameraGroupId
 */
export const delcameraGroup = (cameraGroupId: string | number | Array<string | number>) => {
  return request({
    url: '/camera/camera-group/' + cameraGroupId,
    method: 'delete'
  });
};

/**
 * 查询摄像头分组列表
 * @param query
 * @returns {*}
 */

export const treecameraGroup = (query?: cameraGroupQuery) => {
  return request({
    url: '/camera/camera-group/cameraGroupTree',
    method: 'get',
    params: query
  });
};
